#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "ui_mainwindow.h"

#include <QDialog>
#include <QTreeWidgetItem>
#include <QTimer>
#include "qclickedlabel.h"

class qqbuddy;
class qqgroup;
class MainWindow : public QDialog, public Ui::MainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);

    void EmitMSG();
    void EmitSysMSG();
    void ChangeStatus(qqbuddy* b,int lastStatus);
signals:
    void NewMesgArrived();
    void NewSysInfoArrived();
    void StatusChanged();
protected:
    void changeEvent(QEvent *e);
private slots:
    void onLoginSuccess();
    void toggleSound();
    void OnStatusChanged();
    void timerDone();
    void onClickQunButton();
    void onClickBuddyButton();
    void onClickSetButton();
    void onClickReadButton();
    void showAbout();
    void onMinimumSizeButton();
    void OnClose();
    void onQunClick(QTreeWidgetItem *item, int column);
    void onQunDBClick(QTreeWidgetItem *item, int column);
    void onBuddyClick(QTreeWidgetItem *item, int column);
    void onBuddyDBClick(QTreeWidgetItem *item, int column);
    void onBuddyExpanded(QTreeWidgetItem *item);
    void onBuddyCollapsed(QTreeWidgetItem *item);
    void ShowSysInfo();
    void qtqPlaySound();
private:
    void initOwner();
    void removeBuddy(qqbuddy* b,int lastStatus = 0);
    void addBuddy(qqbuddy* b,int lastStatus = 0);
    void caleGroupTitle(qqgroup* g);
    void retriveGroup();
    void retriveQun();
    void retriveBuddy();
    void showSets(bool visible);
    void initMainSettingWidget(QPushButton* button,QPixmap pixMap);

    QTimer* timer;

};

#endif // MAINWINDOW_H
